package com.lcf.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.lcf.framework.utils.UserUtils;
import com.lcf.system.dao.TotalPriceDao;
import com.lcf.system.entity.TotalPrice;
import com.lcf.system.service.TotalPriceService;
import com.lcf.system.vo.TotalPriceVO;
import org.springframework.stereotype.Service;

/**
 * 收入统计(TotalPrice)表服务实现类
 *
 * @author lcf
 * @since 2025-05-02 11:55:04
 */
@Service("totalPriceService")
public class TotalPriceServiceImpl extends ServiceImpl<TotalPriceDao, TotalPrice> implements TotalPriceService {

    @Override
    public TotalPriceVO getTotalPrice() {
        TotalPrice totalPrice = Db.lambdaQuery(TotalPrice.class)
                .eq(TotalPrice::getUserId, UserUtils.getUserId())
                .one();
        return BeanUtil.copyProperties(totalPrice, TotalPriceVO.class);
    }
}

